/*
  SOLID - Interference Detection Library
  Copyright (C) 1997 Gino van den Bergen

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public
  License along with this library; if not, write to the Free
  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

  Please send remarks, questions and bug reports to gino@win.tue.nl,
  or write to:
                  Gino van den Bergen
		  Department of Mathematics and Computing Science
		  Eindhoven University of Technology
		  P.O. Box 513, 5600 MB Eindhoven, The Netherlands
*/

#ifndef _SOLID_H_
#define _SOLID_H_

#ifdef __cplusplus
extern "C" {
#endif

  typedef double DtScalar;
  typedef void *DtPointer;
  typedef void *DtObjectRef;

  typedef struct DtCollData {
    int numverts;
    DtScalar (*verts)[3];
  } DtCollData;

  typedef enum DtResponseType { 
    DT_NO_RESPONSE,
    DT_SIMPLE_RESPONSE, 
    DT_SMART_RESPONSE
  } DtResponseType;

  typedef void (*DtResponse)(
    DtPointer client_data,
    DtObjectRef object1,
    DtObjectRef object2,
    const DtCollData *coll_data);


  /* Model definition */
  
  extern void dtNewShape(const char *name);
  extern void dtEndShape();
  extern void dtDeleteShape(const char *name);

  extern void dtNewPolygon();
  extern void dtEndPolygon();

  extern void dtVertex(DtScalar x, DtScalar y, DtScalar z);


  /* Object  */

  extern void dtNewObject(DtObjectRef obj, const char *name); 
  extern void dtDeleteObject(DtObjectRef obj);
  extern void dtSelectObject(DtObjectRef obj);

  extern void dtPosition(DtScalar x, DtScalar y, DtScalar z);
  extern void dtOrientation(DtScalar x, DtScalar y, DtScalar z, DtScalar w);
  
  extern void dtOpenGLMatrixf(const float *m);
  extern void dtOpenGLMatrixd(const double *m);

  /* Response */

  extern void dtSetDefaultResponse(DtResponse response, DtResponseType type, 
				   DtPointer client_data);
  
  extern void dtClearDefaultResponse();

  extern void dtSetObjectResponse(DtObjectRef obj, DtResponse response, 
				  DtResponseType type, DtPointer client_data);
  extern void dtClearObjectResponse(DtObjectRef obj);
  extern void dtResetObjectResponse(DtObjectRef obj);

  extern void dtSetPairResponse(DtObjectRef obj1, DtObjectRef obj2, 
				DtResponse response, DtResponseType type, 
				DtPointer client_data);
  extern void dtClearPairResponse(DtObjectRef obj1, DtObjectRef obj2);
  extern void dtResetPairResponse(DtObjectRef obj1, DtObjectRef obj2);


  /* Runtime */

  extern int dtTest();

  extern void dtEnableNBody();
  extern void dtDisableNBody();
  
  extern void dtFixedSizeBBox();
  extern void dtDynamicBBox();

#ifdef __cplusplus
}
#endif

#endif
